package ocean.chinacraft.client.screen.function;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import ocean.chinacraft.common.world.block.function.container.FurnacePlatformBlockContainer;
import ocean.chinacraft.common.constants.Constants;
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;

import javax.annotation.Nonnull;

/**
 * 灶台界面
 *
 * @author zhang
 * @since 2021/11/15
 */
public class FurnacePlatformBlockScreen extends ContainerScreen<FurnacePlatformBlockContainer> {

    private static final ResourceLocation GUI = new ResourceLocation(Constants.MOD_ID,
            "textures/gui/furnace_platform_gui.png");

    public FurnacePlatformBlockScreen(FurnacePlatformBlockContainer screenContainer, PlayerInventory inv, ITextComponent titleIn) {
        super(screenContainer, inv, titleIn);
    }

    @Override
    public void render(@Nonnull MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
        this.renderBackground(matrixStack);
        super.render(matrixStack, mouseX, mouseY, partialTicks);
        this.renderTooltip(matrixStack, mouseX, mouseY);
    }

    @Override
    protected void renderBg(MatrixStack matrixStack, float partialTicks, int x, int y) {
        RenderSystem.color4f(1f, 1f, 1f, 1f);
        this.minecraft.getTextureManager().bind(GUI);
        int i = this.leftPos;
        int j = this.topPos;
        this.blit(matrixStack, i, j, -1, -2, this.imageWidth, this.imageHeight);
        if (menu.isFire()) {
            this.blit(matrixStack, i + 81, j + 15, 176, 0, 13, 17);
        }
    }
}
